# Contributor: lauren n. liberda <lauren@selfisekai.rocks>
# Maintainer: lauren n. liberda <lauren@selfisekai.rocks>
pkgname=certbot-dns
pkgver=2.11.0
pkgrel=0
pkgdesc="Official DNS provider integrations for certbot"
url="https://github.com/certbot/certbot"
arch="noarch"
license="Apache-2.0"
depends="
	certbot~$pkgver
	py3-boto3
	py3-cloudflare
	py3-digitalocean
	py3-dnspython
	py3-dns-lexicon
	py3-google-api-python-client
	py3-httplib2
	py3-oauth2client
	"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	"
checkdepends="
	py3-pytest
	py3-pytest-xdist
	"
subpackages="
	$pkgname-cloudflare
	$pkgname-digitalocean
	$pkgname-dnsimple
	$pkgname-dnsmadeeasy
	$pkgname-gehirn
	$pkgname-google
	$pkgname-linode
	$pkgname-luadns
	$pkgname-nsone
	$pkgname-ovh
	$pkgname-rfc2136
	$pkgname-route53
	$pkgname-sakuracloud
	"
source="https://github.com/certbot/certbot/archive/refs/tags/v$pkgver/certbot-$pkgver.tar.gz"
builddir="$srcdir/certbot-$pkgver"

build() {
	for provider in $subpackages; do
		(
			cd "$provider"
			gpep517 build-wheel \
				--wheel-dir .dist \
				--output-fd 3 3>&1 >&2
		)
	done
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	for provider in $subpackages; do
		.testenv/bin/python3 -m installer $provider/.dist/*.whl
	done
	.testenv/bin/python3 -m pytest -n 4 -p no:warnings certbot-dns-*
}

package() {
	depends="$subpackages"

	for provider in $subpackages; do
		python3 -m installer -d "$pkgdir" \
			$provider/.dist/*.whl
	done
}

cloudflare() {
	depends="py3-cloudflare"

	amove usr/lib/python*/site-packages/certbot_dns_cloudflare*
}

digitalocean() {
	depends="py3-digitalocean"

	amove usr/lib/python*/site-packages/certbot_dns_digitalocean*
}

dnsimple() {
	depends="py3-dns-lexicon"

	amove usr/lib/python*/site-packages/certbot_dns_dnsimple*
}

dnsmadeeasy() {
	depends="py3-dns-lexicon"

	amove usr/lib/python*/site-packages/certbot_dns_dnsmadeeasy*
}

gehirn() {
	depends="py3-dns-lexicon"

	amove usr/lib/python*/site-packages/certbot_dns_gehirn*
}

google() {
	depends="py3-google-api-python-client py3-oauth2client py3-httplib2"

	amove usr/lib/python*/site-packages/certbot_dns_google*
}

linode() {
	depends="py3-dns-lexicon"

	amove usr/lib/python*/site-packages/certbot_dns_linode*
}

luadns() {
	depends="py3-dns-lexicon"

	amove usr/lib/python*/site-packages/certbot_dns_luadns*
}

nsone() {
	depends="py3-dns-lexicon"

	amove usr/lib/python*/site-packages/certbot_dns_nsone*
}

ovh() {
	depends="py3-dns-lexicon"

	amove usr/lib/python*/site-packages/certbot_dns_ovh*
}

rfc2136() {
	depends="py3-dnspython"

	amove usr/lib/python*/site-packages/certbot_dns_rfc2136*
}

route53() {
	depends="py3-boto3"

	amove usr/lib/python*/site-packages/certbot_dns_route53*
}

sakuracloud() {
	depends="py3-dns-lexicon"

	amove usr/lib/python*/site-packages/certbot_dns_sakuracloud*
}

sha512sums="
ba47fc98faaf47278c58e107356371c06039f70ad539d2ca1ac39462bb45c7a6c55ed525d8bd8b11cd35cf807f3423e19309022751a492ba19ded79cfbb6d7f4  certbot-2.11.0.tar.gz
"
